---
title: Guide
description: Guide for building GraphQL APIs with Pothos
---

## Installing

```package-install
npm install --save @pothos/core graphql-yoga
```

## Set up typescript

Pothos is designed to be as type-safe as possible, to ensure everything works correctly, make sure
that your `tsconfig.json` has `strict` mode set to true:

```json
{
  "compilerOptions": {
    "strict": true
  }
}
```

## Create a simple schema

```typescript
import SchemaBuilder from '@pothos/core';

const builder = new SchemaBuilder({});

builder.queryType({
  fields: (t) => ({
    hello: t.string({
      args: {
        name: t.arg.string(),
      },
      resolve: (parent, { name }) => `hello, ${name || 'World'}`,
    }),
  }),
});

const schema = builder.toSchema();
```

## Create a server

The schema generated by Pothos is a standard graphql.js schema and can be used with several graphql
server implementations including `graphql-yoga`.

```typescript
import { createYoga } from 'graphql-yoga';
import { createServer } from 'node:http';

const yoga = createYoga({
  schema: builder.toSchema(),
});

const server = createServer(yoga);

server.listen(3000);
```
